//#include <bits/stdc++.h>
#include "head.h"

using namespace std;
using ll = long long;
#define int long long

void solve()
{
    int n, m;
    cin >> n >> m;
    int ans = 0;
    set<pair<int, int>> s;
    while (m--)
    {
        int x, y;
        cin >> x >> y;
        if (x == y)
        {
            ans++;
            continue;
        }
        else if (x > y) swap(x, y);
        if (s.count({ x,y })) ans++;
        s.insert({ x,y });
    }
    cout << ans;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    //cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}